/**
 * @(#)ISystemExecutionService.java Jan 22, 2010
 *   
 * Copyright  (c) 2009-2010 Wilmar IT Service,  Inc.   
 * All  rights  reserved.   
 * TODO
 */

package com.wilmar.process.core.services.api;

import java.util.Map;

import org.jbpm.api.Execution;
import org.jbpm.api.ProcessInstance;

import com.wilmar.process.entity.InstanceOperateOpinion;
import com.wilmar.process.entity.User;
import com.wilmar.process.entity.vo.ExecutionVO;
import com.wilmar.process.exception.ObjectNotFoundException;

/**
 * @author MaKuBEX Email:makubexnet@gmail.com
 * @version 1.0.0
 */
public interface ISystemExecutionService extends
		IBaseService<ExecutionVO, Execution> {

	/**
	 * 根据运行时编号流转流程
	 * 
	 * @param executionId
	 *            运行时编号
	 * @param user
	 *            用户
	 * @param opinion
	 *            处理意见
	 * @return 流程实例实体
	 */
	public ProcessInstance signalExecutionById(String executionId, User user,
			InstanceOperateOpinion opinion);

	/**
	 * 根据运行时编号流转流程
	 * 
	 * @param executionId
	 *            运行时编号
	 * @param variables
	 *            需要增加或者替换的流程变量
	 * @param user
	 *            用户
	 * @param opinion
	 *            处理意见
	 * @return 流程实例实体
	 */
	public ProcessInstance signalExecutionById(String executionId,
			Map<String, ?> variables, User user, InstanceOperateOpinion opinion);

	/**
	 * 根据运行时编号流转流程
	 * 
	 * @param executionId
	 *            运行时编号
	 * @param signalName
	 *            流转流向
	 * @param user
	 *            用户
	 * @param opinion
	 *            处理意见
	 * @return 流程实例实体
	 */
	public ProcessInstance signalExecutionById(String executionId,
			String signalName, User user, InstanceOperateOpinion opinion);

	/**
	 * 根据运行时编号流转流程
	 * 
	 * @param executionId
	 *            运行时编号
	 * @param variables
	 *            需要增加或者替换的流程变量
	 * @param signalName
	 *            流转流向
	 * @param user
	 *            用户
	 * @param opinion
	 *            处理意见
	 * @return 流程实例实体
	 */
	public ProcessInstance signalExecutionById(String executionId,
			Map<String, ?> variables, String signalName, User user,
			InstanceOperateOpinion opinion);

	/**
	 * 根据运行时编号获取运行时实体
	 * 
	 * @param executionId
	 *            运行时编号
	 * @return 运行时实体
	 * @throws ObjectNotFoundException
	 *             当运行时编号没有对应的运行时实体时
	 */
	public Execution getDetailById(String executionId)
			throws ObjectNotFoundException;
}
